﻿using ProjBackEnd.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ProjBackEnd.Areas.Financial.Models
{
    public class ResultReviewCase : BaseResultInfo
    {
        private List<ReviewCaseExt> lstRevcase = new List<ReviewCaseExt>();
        /// <summary>
        /// 审批方案信息列表
        /// </summary>
        public List<ReviewCaseExt> revcaselist { get { return lstRevcase; } set { lstRevcase = value; } }
    }
    public class ResultReviewCaseDetail : BaseResultInfo
    {
        private List<ReviewCaseDetailExt> lstReviewcaseDetail = new List<ReviewCaseDetailExt>();
        /// <summary>
        /// 审批方案明细
        /// </summary>
        public List<ReviewCaseDetailExt> revcasedetaillist { get { return lstReviewcaseDetail; }set { lstReviewcaseDetail = value; } }
    }
    public class ReslutReviewDeny : BaseResultInfo
    {
        /// <summary>
        /// 审批拒绝意见列表
        /// </summary>
        public List<ReviewDenyExtInfo> denylist { get; set; }
    }
    public class ResultApprovalCount : BaseResultInfo
    {
        /// <summary>
        /// 待审批的申请单数量
        /// </summary>
        public int approvalcount { get; set; }
    }

    public class ReqReviewCase : BaseUserRequest
    {
        public ReviewCase revcase { get; set; }
    }
    public class ReqReviewCaseDetail : BaseUserRequest
    {
        public ReviewCaseDetail revdtl { get; set; }
    }
    public class ReqApplyApproval : BaseUserRequest
    {
        /// <summary>
        /// 申请单流水号
        /// </summary>
        [Required(ErrorMessage ="申请单流水号是必需的")]
        public int applyid { get; set; }
        /// <summary>
        /// 审批结果：Y-同意；D-拒绝
        /// </summary>
        [Required(ErrorMessage = "审批结果是必需的")]
        public string revlb { get; set; }
        /// <summary>
        /// 审批序号
        /// </summary>
        [Required(ErrorMessage = "审批序号是必需的")]
        public int revsort { get; set; }
        /// <summary>
        /// 拒绝理由
        /// </summary>
        [RequiredConditional("revlb","D",ErrorMessage ="审批拒绝时必须填写理由")]
        public string reason { get; set; }
    }


    public class ReqApprovalBack: BaseUserRequest
    {
        /// <summary>
        /// 申请单流水号
        /// </summary>
        [Required(ErrorMessage = "申请单流水号是必需的")]
        public int applyid { get; set; }
        /// <summary>
        /// 拒绝理由
        /// </summary>
        [MaxLength(260, ErrorMessage = "拒绝理由长度超限")]
        public string reason { get; set; } = "";
    }


    /// <summary>
    /// 审批方案基本信息
    /// </summary>
    public class ReviewCase : BaseOperableEntity
    {
        /// <summary>
        /// 审批方案流水号
        /// </summary>
        [RequiredConditional("optlb","UD",ErrorMessage ="审批方案流水号是必需的")]
        public int revcaseid { get; set; }
        /// <summary>
        /// 归属公司
        /// </summary>
        [RequiredConditional("optlb", "I", ErrorMessage = "归属公司是必需的")]
        public string comcd { get; set; }
        /// <summary>
        /// 归属部门
        /// </summary>
        [RequiredConditional("optlb", "I", ErrorMessage = "归属部门是必需的")]
        public string deptcd { get; set; }
        /// <summary>
        /// 审批方案名称
        /// </summary>
        public string casenm { get; set; }
        /// <summary>
        /// 审批方案序号
        /// </summary>
        public int sortval { get; set; }
        /// <summary>
        /// 有效标志：Y-有效；N-无效
        /// </summary>
        public string validlb { get; set; }
        /// <summary>
        /// 模板分类
        /// </summary>
        public string casetp { get; set; }
    }

    /// <summary>
    /// 审批方案扩展信息
    /// </summary>
    public class ReviewCaseExt : ReviewCase
    {
        /// <summary>
        /// 建档人
        /// </summary>
        public string creator { get; set; }
        /// <summary>
        /// 建档时间
        /// </summary>
        public string createdt { get; set; }
        /// <summary>
        /// 审批方案类别名称
        /// </summary>
        public string casetpnm { get; set; }
    }

    /// <summary>
    /// 审批方案明细
    /// </summary>
    public class ReviewCaseDetail : BaseOperableEntity
    {
        /// <summary>
        /// 审批方案流水号
        /// </summary>
        [Required(ErrorMessage = "审批方案流水号是必需的")]
        public int revcaseid { get; set; }
        /// <summary>
        /// 审批顺序
        /// </summary>
        [Required(ErrorMessage = "审批方案序号是必需的")]
        public int sortval { get; set; }
        /// <summary>
        /// 审批类别：0-选审/独立审核；1-共审
        /// </summary>
        [RequiredConditional("optlb", "I", ErrorMessage = "审批类别是必需的")]
        public string revtp { get; set; }
        /// <summary>
        /// 首选审批人
        /// </summary>
        [RequiredConditional("optlb", "I", ErrorMessage = "首选审批人是必需的")]
        public string reviewer1 { get; set; }
        /// <summary>
        /// 次要审批人
        /// </summary>
        public string reviewer2 { get; set; }
    }

    /// <summary>
    /// 审批方案明细扩展信息
    /// </summary>
    public class ReviewCaseDetailExt : ReviewCaseDetail
    {
        /// <summary>
        /// 首选审批人姓名
        /// </summary>
        public string reviewernm1 { get; set; }
        /// <summary>
        /// 次要审批人姓名
        /// </summary>
        public string reviewernm2 { get; set; }
        /// <summary>
        /// 审批类别名称
        /// </summary>
        public string revtpnm { get; set; }
    }

    /// <summary>
    /// i 审批拒绝意见核心信息
    /// </summary>
    public class ReviewDenyCore
    {
        /// <summary>
        /// 申请单流水号
        /// </summary>
        public int applyid { get; set; }
        /// <summary>
        /// 申请单类别：BILL-业务账单；FN-付费联系单
        /// </summary>
        public string applytp { get; set; }
        /// <summary>
        /// 审批拒绝意见
        /// </summary>
        public string advice { get; set; }
    }

    /// <summary>
    ///  ii 审批拒绝意见扩展信息
    /// </summary>
    public class ReviewDenyExtInfo : ReviewDenyCore
    {
        /// <summary>
        /// 审批人姓名
        /// </summary>
        public string reviewer { get; set; }
        /// <summary>
        /// 审批意见填写时间
        /// </summary>
        public string createdt { get; set; }
    }


}